package com.shop.zkmall.app.controller.a;

import com.shop.zkmall.app.domain.req.*;
import com.shop.zkmall.app.service.a.ICereShopMarketingService;
import com.shop.zkmall.app.service.product.CereProductClassifyService;
import com.shop.zkmall.app.utils.LoginHelper;
import com.shop.zkmall.commons.result.R;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("product")
@RequiredArgsConstructor
@Tag(name = "商品模块", description = "商品模块")
public class ProduceController {

    private final CereProductClassifyService cereProductClassifyService;

    private final ICereShopMarketingService cereShopMarketingService;

    private final LoginHelper loginHelper;


    /**
     * 发布商品 (0免费 1砍价 2竞拍 3闪购)
     */
    @PostMapping("/addShopMarketingProduct")
    @Operation(summary = "发布商品 (0免费 1砍价 2竞拍 3闪购)")
    public R<?> addShopMarketingProduct(@RequestBody CereShopMarketingReq cereShopMarketingReq) {
        return cereShopMarketingService.addShopMarketingProduct(cereShopMarketingReq);
    }

    /**
     * 商品管理列表
     */
    @PostMapping("/productList")
    @Operation(summary = "商品管理列表")
    public R<?> productList(@RequestBody ProductListReq productListReq) {
        return cereShopMarketingService.productList(productListReq);
    }


    /**
     * 商品详情
     */
    @PostMapping("/productDetail")
    @Operation(summary = "商品详情")
    public R<?> productDetail(@RequestBody productDetailReq productDetailReq) {
        return cereShopMarketingService.productDetail(productDetailReq);
    }

    /**
     * 编辑商品
     */
    @PostMapping("/editProduct")
    @Operation(summary = "编辑商品")
    public R<?> productList(@RequestBody EditCereShopMarketingReq editCereShopMarketingReq) {
        return cereShopMarketingService.editProduct(editCereShopMarketingReq);
    }


    /**
     * 批量上架/下架
     */
    @PostMapping("/batchOnLine")
    @Operation(summary = "批量上架/下架")
    public R<?> batchOnLine(@RequestBody BatchOnLineReq batchOnLineReq) {
        return cereShopMarketingService.batchOnLine(batchOnLineReq);
    }

}
